// components/common/brand-store-apply-result/index.js
import componentBehavior from '../../../behaviors/component';
import { COMPONENT_OPTIONS } from '../../../constants/common';

Component({
    behaviors: [componentBehavior],
    options: {
        ...COMPONENT_OPTIONS,
    },
    properties: {
        type: {
            type: String,
            value: 'spokesman', // spokesman 代言人 | distributor 分销员
        },
        open: {
            type: Boolean,
            value: true,
        },
        result: {
            type: String,
            value: '',
        },
        title: {
            type: String,
            value: '',
        },
    },
    observers: {
        'type, title': function (type, title) {
            let appTitle = title ? title : (type == 'spokesman' ? '代言人' : '分销员');
            this.setData({ appTitle });
        },
    },
    data: {
        appTitle: '',
    },
    methods: {
        handleReapply() {
            this.triggerEvent('reapply');
        },
        handleAttention() {
            this.triggerEvent('attention');
        },
        handleOpen() {
            this.triggerEvent('open');
        },
        handleBack() {
            this.triggerEvent('back');
        },
    },
})
